package net.flintx.array;

import java.util.Arrays;

/**
 * Created by flintx on 2018/1/13.
 */
public class MaximumProductOfThreeNumbers {
    public int maximumProduct(int[] nums) {
        Arrays.sort(nums);
        int nnp = nums[0] * nums[1] * nums[nums.length - 1];
        int ppp = nums[nums.length - 3] * nums[nums.length - 2] * nums[nums.length - 1];
        return Math.max(nnp, ppp);
    }
}
